
import java.lang.*;
import java.util.*;

public class DateAndTime
{
   // for current date and time
    GregorianCalendar cal;
    static int month;
    static int year;
    static int day;
  
    static String am_pm;
    static int hour;
    static int minute;
    static  int second;
  
       // current date and time
    public void GetDateAndTime(){
    cal = new GregorianCalendar();
    month = cal.get(Calendar.MONTH);
    year = cal.get(Calendar.YEAR);
    day = cal.get(Calendar.DAY_OF_MONTH);
                        
    hour = cal.get(Calendar.HOUR);
    minute = cal.get(Calendar.MINUTE);
    second = cal.get(Calendar.SECOND);
    if(cal.get(Calendar.AM_PM) == 0)
       am_pm = "AM";
    else
       am_pm = "PM";
    }
}
